package com.zhentao.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhentao.pojo.TOrder;
import com.zhentao.service.TOrderService;
import com.zhentao.vo.Query;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private TOrderService tOrderService;

    //查询表中的 数据
    @RequestMapping("/findAll")
    public String findAll(){
        List<TOrder> list = tOrderService.list();
        return list.toString();
    }


    //多条件查询，模糊查询
    @RequestMapping("/findPage")
    public Result findPage(@RequestBody Query query){
        Page<TOrder> page = tOrderService.findPage(query);
        return Result.OK(page);
    }

}
